$(".modifyStorageRecord").on("click",function(){
    var obj = $(this);
    window.location.href=path+"/sys/adoptanimal/view/" + obj.attr("id");
});

function cancleBtn(){
    $('.zhezhao').css('display', 'none');
    $('#removeBi').fadeOut();
}

function changeDLGContent(contentStr){
    var p = $(".removeMain").find("p");
    p.html(contentStr);
}

$(".deleteStorageRecord").on("click",function(){
    storageRecordObj = $(this);
    changeDLGContent("确定删除申请信息吗？");
    openYesOrNoDLG();
});

function openYesOrNoDLG(){
    $('.zhezhao').css('display', 'block');
    $('#removeBi').fadeIn();
}

$('#yes').click(function () {
    deleteVolunteerApply(storageRecordObj);
});

$('#no').click(function () {
    cancleBtn();
});

var storageRecordObj

function deleteVolunteerApply(obj) {
    $.ajax({
        type:"DELETE",
        url:path+"/sys/adoptanimal/del/"+obj.attr("id"),
        dataType:"json",
        success:function(data){
            if(data.result == "true"){//删除成功：移除删除行
                cancleBtn();
                obj.parents("tr").remove();
            }else if(data.result == "false"){//删除失败
                changeDLGContent("对不起，删除【"+obj.attr("storageRecordcc")+"】失败");
            }else if(data.result == "notexist"){
                changeDLGContent("对不起，【"+obj.attr("storageRecordcc")+"】不存在");
            }
        },
        error:function(data){
            alert("对不起，删除失败");
        }
    });
}

$(".viewStorageRecord").on("click",function(){
    //将被绑定的元素（a）转换成jquery对象，可以使用jquery方法
    var obj = $(this);
    window.location.href=path+"/sys/adoptanimal/toView/" + obj.attr("id");
});